package org.example.score.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.score.domain.Byzhxlqk;
import org.example.score.domain.Zysyjxxncsqk;
import org.example.score.service.ZysyjxxncsqkService;
import org.example.score.mapper.ZysyjxxncsqkMapper;
import org.example.util.result.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author abc
* @description 针对表【pd_zysyjxxncsqk(专业实验教学校内场所情况)】的数据库操作Service实现
* @createDate 2025-03-10 09:46:30
*/
@Service
public class ZysyjxxncsqkServiceImpl extends ServiceImpl<ZysyjxxncsqkMapper, Zysyjxxncsqk>
    implements ZysyjxxncsqkService{

    @Autowired
    private ZysyjxxncsqkMapper zysyjxxncsqkMapper;

    @Override
    public Double getScores(Parameter parameter) {
        Double res = -1.0;
        String school = parameter.getSchool();
        String code = parameter.getCode();
        String nameInSchool = parameter.getNameInSchool();
        String codeInSchool = parameter.getCodeInSchool();
        QueryWrapper<Zysyjxxncsqk> queryWrapper = new QueryWrapper();
        queryWrapper.eq("xxdm", school)
                .eq("zydm", code)
                .eq("xnzymc", nameInSchool);
        List<Zysyjxxncsqk> tmp = zysyjxxncsqkMapper.selectList(queryWrapper);
        if (tmp.isEmpty()) return res;
        else res = tmp.get(0).getZtzydf();
        return res;


    }
}

